<template>
  <div class="vacation">
    <div class="myvacat">
      <span @click="clickMyvacation">添加假期</span>
    </div>

    <!-- 表格 -->
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="date" label="日期"></el-table-column>
      <el-table-column prop="times" label="时间"></el-table-column>
      <el-table-column prop="beizhu" label="备注"></el-table-column>
      <el-table-column label="操作">
        <el-button size="small">修改</el-button>
        <el-button size="small">删除</el-button>
      </el-table-column>
    </el-table>
    <!-- 添加假期的对话框 -->
    <el-dialog
      title="添加假期"
      :visible.sync="dialogVisibleVacation"
      width="50%"
      :before-close="handleClose"
    >
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="开始日期">
          <el-input v-model="form.kaishi"></el-input>
        </el-form-item>
        <el-form-item label="结束日期">
          <el-input v-model="form.jieshu"></el-input>
        </el-form-item>
        <p>*结束当天也属于假期范围</p>
        <el-form-item label="时间">
          <!-- <el-checkbox-group v-model="form.type"> -->
          <el-checkbox label="全天" name="type"></el-checkbox>
          <el-checkbox label="上午" name="type"></el-checkbox>
          <el-checkbox label="下午" name="type"></el-checkbox>
          <el-checkbox label="晚上" name="type"></el-checkbox>
          <!-- </el-checkbox-group> -->
        </el-form-item>
        <el-form-item label="备注">
          <el-input type="textarea" v-model="form.desc"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibleVacation = false">取 消</el-button>
        <el-button type="primary" @click="tijiaojaiqi">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "Myvacation",
  inject:['reload'],
  data() {
    return {
      form: {},
      dialogVisibleVacation: false,
      tableData: [
        {
          date: "2016-05-02----2016-05-07",
          times: "下午",
          beizhu: "去旅游"
        }
      ]
    };
  },
  mounted() {
    // 获取网络请求渲染表格
  },
  methods: {
    clickMyvacation() {
      //添加假期的函数
      this.dialogVisibleVacation = true;
    },
    handleClose() {
      this.dialogVisibleVacation = false;
    },
    tijiaojaiqi(){
      // 提交假期表单网络请求成功后
      if(true){
          this.dialogVisibleVacation = false;
          this.reload()
      }

       
    }
  }
};
</script>

<style lang="less" scoped>
.vacation {
  width: 80%;
  margin-bottom: 300px;
}
.myvacat {
  text-align: right;

  color: #cc0000;
  span {
    font-size: 16px;
    cursor: pointer;
  }
}
</style>